﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo10
{
    class Program
    {
        static void Main(string[] args)
        {
            //在 Main 方法中创建一个字符串类型的数组，并存入 5 个值，然后将数组中下标是偶数的元素输出。
            string[] arr = new string [5];
            for (int i = 0; i < arr.Length; i++)
            {
                Console.WriteLine("请输入第{0}个字符串：",(i+1));
                arr[i] = Console.ReadLine();
            }
            Console.Write("原数组：");
            foreach (var item in arr)
            {
                Console.Write(item+" ");
            }
            Console.WriteLine();
            int[] brr = new int[arr.Length];
            for (int i = 0; i < arr.Length; i++)
            {
                brr[i] = Convert.ToInt32(arr[i]);
            }
            Console.Write("后数组：");
            foreach (var num in brr)
            {
                Console.Write(num+" ");
            }
            Console.WriteLine();
            for (int i = 0; i < brr.Length; i++)
            {
                if (brr[i]%2==0)
                {
                    Console.WriteLine("arr[{0}]是偶数",i);
                }
            }
        }
    }
}
